<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 数组 -->
  <script>
    //1 .创建数组
    let arr =new Array();
    for(let i =0; i< 10 ; i++){
        arr[i] = i+1;
    }
    console.log(arr)
    arr[10] = "hello";
    //1.2 创建数组
    let array = [0,1,2,4,"hello"];
    console.log(array);
    //2. 插入元素
    //2.1 根据下标插入元素
    array[20] = "hehe";
    console.log(array);
    //2.2 push() 
    array.push(22);
    console.log(array);
    
    [ 0,
    1,
    2,
    4,
    "hello",
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    "hehe",
    22
]
    // 3 . 删除元素
    array.splice(5,15);
    console.log(array);
    //4.修改元素
    array[0] = "nihao";
    console.log(array);
  </script>
</body>
</html>